<?php
require_once("../includes/connect.php");
$menu_id = $_POST["menu_id"];
$page_content = $_POST["page_content"];
$sql_check_exist = "SELECT p.page_content FROM tb_page_content p WHERE p.menu_id=".$menu_id;
$query_check_exist = mysql_query($sql_check_exist);
$num_row = mysql_num_rows($query_check_exist);
if ($num_row>0) {
	$sql = "UPDATE tb_page_content SET page_content = '".$page_content."' WHERE menu_id=".$menu_id ;
	mysql_query($sql);
	echo 0;
}else{
	$sql = "INSERT INTO tb_page_content (page_content,menu_id) VALUES ('".$page_content."',".$menu_id.")";
	mysql_query($sql);
	echo 0;
}


?>